/*
 * @file    :task_glucose.h
 * @author  :LingFengLu
 * @date    :2023-06-08
 */

#ifndef _TASK_GLUCOSE_H_
#define _TASK_GLUCOSE_H_
#include "global.h"
#include "devos.h"
#include "sensor.h"
//Constant definition    宏定义
#define TYPE_MASK                   0x1F
#define STATE_MASK                  (~(TYPE_MASK))

//Type definition    类型定义
typedef enum
{
    TASK_GLUCOSE_PARAM_BUSY = 0,
    TASK_GLUCOSE_PARAM_CONTROL,
    TASK_GLUCOSE_PARAM_STATE,
    TASK_GLUCOSE_PARAM_GLUCOSE,
    TASK_GLUCOSE_PARAM_CALIBRATON,
    TASK_GLUCOSE_PARAM_NEW_SENSOR,
    TASK_GLUCOSE_PARAM_HYPO,
    TASK_GLUCOSE_PARAM_HYPER,
    TASK_GLUCOSE_PARAM_EXPIRATION,
    TASK_GLUCOSE_PARAM_INIT_COUNT_DOWN,
    TASK_GLUCOSE_PARAM_REFERENCE_IMP,
    TASK_GLUCOSE_PARAM_REFERENCE_SHIFT,
    TASK_GLUCOSE_PARAM_REFERENCE_ALL,
    TASK_GLUCOSE_PARAM_DEFAULT_PARAM,
    TASK_GLUCOSE_PARAM_CAL_FACTOR,
    TASK_GLUCOSE_PARAM_OFFSET,
    TASK_GLUCOSE_PARAM_GC_BIAS_TRIMMING,
    TASK_GLUCOSE_PARAM_GC_IMEAS_TRIMMING,
    TASK_GLUCOSE_PARAM_HYPO_HYPER,
    TASK_GLUCOSE_COUNT_PARAM
} task_glucose_parameter;

typedef enum
{
    TASK_GLUCOSE_FLAG_BUSY = 0,
    TASK_GLUCOSE_FLAG_OLD_SENSOR,
    TASK_GLUCOSE_FLAG_NEW_SENSOR,
    TASK_GLUCOSE_FLAG_EXPIRATION,
    TASK_GLUCOSE_FLAG_SENSOR_ERROR,
    TASK_GLUCOSE_FLAG_GLUCOSE_INVALID,
    TASK_GLUCOSE_FLAG_RECOMMEND_CAL,
    TASK_GLUCOSE_FLAG_CHECK_SENSOR,
    TASK_GLUCOSE_COUNT_FLAG
} task_glucose_flag;

typedef enum
{
    TASK_GLUCOSE_STARTUP_INIT_DONE = 0,
    TASK_GLUCOSE_STARTUP_NEW = -1,
    TASK_GLUCOSE_STARTUP_CHECKING = -2
    
} task_glucose_startup;

//Function declaration    函数申明
void TaskGlucose_Init
(
	devos_task_handle t_TaskHandle
);
void TaskGlucose_Process
(
	devos_task_handle t_TaskHandle
);
uint TaskGlucose_SetConfig
(
	uint ui_Parameter,
	const uint8 *u8p_Value,
	uint ui_Length
);
uint TaskGlucose_GetConfig
(
	uint ui_Parameter,
	uint8 *u8p_Value,
	uint *uip_Length
);
uint8 TaskGlucose_ClipGlucose
(
    sint32 i32_Value
);
void TaskGlucose_SkipDelay
( 
    sint32 s32_Time
);
//Golbal variable declaration   全局变量申明










#endif

